
// Deferred rendering geometry pass.
// Pixel shader.
//------------------------------------------

// Typedefs.
//------------------------------------------
struct Pixel
{
    float4 position             : SV_POSITION;
	float3 normal               : NORMAL;
	float3 world_view_direction : TEXCOORD0;
	float3 world_position       : TEXCOORD1;
};

struct GBuffer
{
	float3 world_position       : SV_TARGET0;
	float3 world_view_direction : SV_TARGET1;
	float3 normal               : SV_TARGET2;
	float3 ambient				: SV_TARGET3;
	float3 diffuse				: SV_TARGET4;
	float3 specular				: SV_TARGET5;
	float3 shininess			: SV_TARGET6;
};

// Globals.
//------------------------------------------
cbuffer MaterialBuffer
{
	float1 m_opacity;
	float3 m_ambient;
	float1 m_shininess;
	float3 m_diffuse;
	float3 m_specular;
	float1 m_padding;
}

GBuffer Main(Pixel input)
{
	GBuffer output;

	output.world_position 	    = input.world_position;
	output.world_view_direction = input.world_view_direction;
	output.normal  			    = input.normal;
	
	// Deferred rendering doesn't allow transparency.
	output.ambient 				= m_ambient;
	output.diffuse 				= m_diffuse;
	output.specular 			= m_specular;
	output.shininess.rgb 		= m_shininess;

	return output;
}